package other.optimization;

import org.junit.Test;

import java.io.*;
import java.util.StringTokenizer;

public class StringOptimization {
/***
 *  字符串分割
 */
    @Test
    public void test(){
        String str="1,2,3,4,5,6,7,8,9";
        StringTokenizer stringTokenizer = new StringTokenizer(str,",");
        while (stringTokenizer.hasMoreElements()){
            System.out.println(stringTokenizer.nextToken());
        }
    }
    @Test
    public void testStringAdd9(){
        String a = "a";
        a = a+"1"+"2"+a;
        System.out.println(a);
    }
    @Test
    public void getSystemInfo(){
        System.getProperties().list(System.out);
        try {
            OutputStream outputStream = new FileOutputStream(new File("D:"+File.separator+"test.txt"));
            outputStream.write("中国人民共和国万岁".getBytes("iso-8859-1"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
